<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich"
                xmlns:mumu="http://java.sun.com/jsf/composite/mumu">
    <h:head>
        <style type="text/css">
            .userCln {
                width: 120px;
            }
        </style>
    </h:head>

    <rich:dataTable id="userlist" value="#{userBean.lazyDataModelLazy}" var="record" keepSaved="true"
                    iterationStatusVar="it" rows="15" rowClasses="odd-row,even-row">
        <f:facet name="header">
            <h:outputText value="#{msg['user.table']}"/>
        </f:facet>
        <rich:column headerClass="signWidth">
            <f:facet name="header">#</f:facet>
            #{it.index +1}
        </rich:column>
        <ui:decorate template="/WEB-INF/template/sortColumn.xhtml">
            <ui:param name="bean" value="#{userBean}"/>
            <ui:param name="property" value="userName"/>
            <ui:param name="sortName" value="#{msg['user.table.userName']}"/>
            <ui:param name="render" value="userlist@body userScroller @this"/>
            <ui:define name="outText">
                <h:outputText id="userName" value="#{record['userName']}"/>
            </ui:define>
        </ui:decorate>
        <rich:column>
            <f:facet name="header">#{msg['user.table.realName']}</f:facet>
            <h:commandLink value="#{record.nickName}" onclick="alert('aaa')">
                <f:ajax event="click" execute="@this" render="@none"/>
            </h:commandLink>
        </rich:column>
        <rich:column style="width:5%;">
            <f:facet name="header">#{msg['user.table.gender']}</f:facet>
            #{record.gender eq 0 ? msg['user.man']:msg['user.woman']}
        </rich:column>
        <rich:column>
            <f:facet name="header">#{msg['user.form.email']}</f:facet>
            #{record.email}
        </rich:column>
        <ui:decorate template="/WEB-INF/template/sortColumn.xhtml">
            <ui:param name="bean" value="#{userBean}"/>
            <ui:param name="property" value="birthday"/>
            <ui:param name="sortName" value="#{msg['user.table.birthday']}"/>
            <ui:param name="render" value="userlist@body userScroller @this"/>
            <ui:define name="outText">
                <mumu:timeOutput value="#{record.birthday}"/>
            </ui:define>
        </ui:decorate>
        <rich:column>
            <f:facet name="header">#{msg['user.table.state']}</f:facet>
            <h:outputText id="state" value="#{record.state == 0 ? '禁用' : '正常'}"/>
        </rich:column>
        <rich:column>
            <f:facet name="header">#{msg['table.action']}</f:facet>
            <a4j:commandLink styleClass="no-decor" limitRender="true" render="editUserEntity,UserPopupCmpHeader"
                             rendered="#{record['state'] == 1}"
                             execute="@this" oncomplete="PawnPopup.show('userEntity')">
                <h:graphicImage value="#{resource['images/edit.gif']}"/>
                <f:setPropertyActionListener value="#{record}" target="#{userBean.entity}"/>
            </a4j:commandLink>

            <a4j:commandLink value="#{record.state == 1 ? '禁用' :'启用'}"
                            oncomplete="#{rich:component('disablePop')}.show();return false;" id="disable">
                <f:setPropertyActionListener value="#{record}" target="#{userBean.entity}"/>
            </a4j:commandLink>
            <mumu:removeLink id="RemoveConfirm" title="#{msg['action.delete']}"
                             currentValue="#{record}" bean="#{userBean}">
            </mumu:removeLink>
        </rich:column>
        <f:facet name="footer">
            <rich:dataScroller id="userScroller"/>
        </f:facet>
    </rich:dataTable>
    <mumu:confirmAction msg="#{msg['delete.msg']}" render="userlist@body userScroller" faction="#{userBean.remove}"/>
    <mumu:confirmAction popupId="disablePop" fname="disableUser" okButton="禁用" faction="#{userBean.disabledUser}" render="userlist@body" msg="你好，是否禁用所选用户!"/>
</ui:composition>